﻿using BLL;
using Common;
using DevExpress.Xpo;
using DevExpress.Xpo.DB;
using POS.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace POS
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            try
            {
                bool createNew;
                using (System.Threading.Mutex m = new System.Threading.Mutex(true, Application.ProductName, out createNew))
                {
                    if (createNew)
                    {
                        DatabaseSchema.Update();
                        DevExpress.UserSkins.BonusSkins.Register();
                        DevExpress.Skins.SkinManager.EnableFormSkins();
                        //new Cofco.Common.DevConvertToChinese();
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        Application.Run(new Login());
                    }
                    else
                    {
                        MsgBox.ShowWarning("程序己启动,请查看托盘界面！");
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteErrorLog("发生未处理异常，程序未正确退出", ex);
            }
        }
    }
}
